/**
 * tjftp -- A simple FTP server, using the ANSI C
 * Copyright (C) 2011  degui.chen <degui.chen@qq.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef SESSION_H_
#define SESSION_H_
#include <sys/types.h>
#include "lib/settings.h"

typedef struct _sesstion Sesstion, *PSesstion;
struct _sesstion {
	int id;
	char username[100];
	char password[100];
	time_t lifetime;
	int is_login;
	char root_path[255];
	char pwd[255];
	int permit_read;
	int permit_write;
	int permit_modify;
	int permit_delete;
	int is_port_mode;
	char port_address[255];
	int is_pasv_mode;
	PSesstion next;
};

void tj_sesstion_dump(int id);
PSesstion tj_sesstion_get(int id);
PSesstion tj_sesstion_init(int id, PSettings settings);
void tj_sesstion_destory(int id);
void tj_sesstion_gc();
PSesstion tj_sesstion_username(int id, char* username);
PSesstion tj_sesstion_password(int id, char* password);
PSesstion tj_sesstion_authenticate(int id);

#endif /* SESSION_H_ */
